package com.ay.weixin.fdc.boss.blog.db;

import java.sql.SQLException;
import java.util.List;

import lizar.db.ibatis.Dao;

import com.ay.weixin.fdc.boss.blog.domain.BlogContent;

public class BlogContentDao extends Dao {

	public void insert(BlogContent content) throws SQLException{
		this.sqlMapper.insert("blog_content.insert",content);
	}
	
	public BlogContent getById(long id) throws SQLException{
		return (BlogContent)this.sqlMapper.queryForObject("blog_content.getById",id);
	}
	
	public void update(BlogContent content) throws SQLException{
		this.sqlMapper.insert("blog_content.update",content);
	}
	
	public int getMaxPos(long sa_id) throws SQLException{
		Integer max=(Integer)this.sqlMapper.queryForObject("blog_content.getMaxPos",sa_id);
		if(max==null){
			return 0;
		}
		return max+1;
	}
	
	public void deleteBySaId(long sa_id) throws SQLException{
		this.sqlMapper.delete("blog_content.deleteBySaId",sa_id);
	}
	
	public void delete(long id) throws SQLException{
		this.sqlMapper.delete("blog_content.delete",id);
	}
	
	public List<BlogContent> getBySAId(long sa_id) throws SQLException{
		return (List<BlogContent>)this.sqlMapper.queryForList("blog_content.getBySAId",sa_id);
	}
	
}
